summaryrefslogtreecommitdiffstats
path: root/Server
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2020-04-12 13:34:24 +0200
committerMattes D <github@xoft.cz>2020-04-12 13:34:24 +0200
commitfb05ea7cf740ecd59b24d4f7417ad44c30ba53d5 (patch)
treec3723655ff577be1df26573405635d0280249ceb /Server
parentRemoved extended ASCII, and added a check against it. (#4642) (diff)
downloadcuberite-fb05ea7cf740ecd59b24d4f7417ad44c30ba53d5.tar
cuberite-fb05ea7cf740ecd59b24d4f7417ad44c30ba53d5.tar.gz
cuberite-fb05ea7cf740ecd59b24d4f7417ad44c30ba53d5.tar.bz2
cuberite-fb05ea7cf740ecd59b24d4f7417ad44c30ba53d5.tar.lz
cuberite-fb05ea7cf740ecd59b24d4f7417ad44c30ba53d5.tar.xz
cuberite-fb05ea7cf740ecd59b24d4f7417ad44c30ba53d5.tar.zst
cuberite-fb05ea7cf740ecd59b24d4f7417ad44c30ba53d5.zip
Diffstat (limited to 'Server')
-rw-r--r--Server/Plugins/Debuggers/Debuggers.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/Server/Plugins/Debuggers/Debuggers.lua b/Server/Plugins/Debuggers/Debuggers.lua
index 4cf825f12..1505904a8 100644
--- a/Server/Plugins/Debuggers/Debuggers.lua
+++ b/Server/Plugins/Debuggers/Debuggers.lua
@@ -30,6 +30,7 @@ function Initialize(a_Plugin)
PM:AddHook(cPluginManager.HOOK_CHUNK_UNLOADING, OnChunkUnloading);
PM:AddHook(cPluginManager.HOOK_WORLD_STARTED, OnWorldStarted);
PM:AddHook(cPluginManager.HOOK_PROJECTILE_HIT_BLOCK, OnProjectileHitBlock);
+ PM:AddHook(cPluginManager.HOOK_PLAYER_RIGHT_CLICK, OnPlayerRightClick)
-- _X: Disabled WECUI manipulation:
-- PM:AddHook(cPluginManager.HOOK_PLUGIN_MESSAGE, OnPluginMessage);
@@ -714,6 +715,26 @@ end
+function OnPlayerRightClick(a_Player)
+ -- If the player is holding a cake item, make them throw a cake block, using a FallingBlock entity:
+ if (a_Player:GetInventory():GetEquippedItem().m_ItemType == E_ITEM_CAKE) then
+ local World = a_Player:GetWorld()
+ local Position = a_Player:GetPosition() + Vector3d(0, 1.5, 0)
+ local EntityID = World:SpawnFallingBlock(Vector3i(Position), E_BLOCK_CAKE, 0)
+
+ World:DoWithEntityByID(EntityID,
+ function (Entity)
+ Entity:TeleportToCoords(Position.x, Position.y, Position.z)
+ Entity:SetSpeed(a_Player:GetLookVector() * 30)
+ end
+ )
+ end
+end
+
+
+
+
+
function OnPlayerRightClickingEntity(a_Player, a_Entity)
LOG("Player " .. a_Player:GetName() .. " right-clicking entity ID " .. a_Entity:GetUniqueID() .. ", a " .. a_Entity:GetClass());
return false;